/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package modelo;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Francisco
 */
@Entity
@Table(name = "persona_contacto")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "PersonaContacto.findAll", query = "SELECT p FROM PersonaContacto p"),
    @NamedQuery(name = "PersonaContacto.findByIdPersonaContacto", query = "SELECT p FROM PersonaContacto p WHERE p.idPersonaContacto = :idPersonaContacto"),
    @NamedQuery(name = "PersonaContacto.findByContacto", query = "SELECT p FROM PersonaContacto p WHERE p.contacto = :contacto"),
    @NamedQuery(name = "PersonaContacto.findByTipo", query = "SELECT p FROM PersonaContacto p WHERE p.tipo = :tipo")})
public class PersonaContacto implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_persona_contacto")
    private Integer idPersonaContacto;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "contacto")
    private String contacto;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "tipo")
    private String tipo;
    @JoinColumn(name = "id_persona", referencedColumnName = "id_persona")
    @ManyToOne(optional = false)
    private Persona idPersona;

    public PersonaContacto() {
    }

    public PersonaContacto(Integer idPersonaContacto) {
        this.idPersonaContacto = idPersonaContacto;
    }

    public PersonaContacto(Integer idPersonaContacto, String contacto, String tipo) {
        this.idPersonaContacto = idPersonaContacto;
        this.contacto = contacto;
        this.tipo = tipo;
    }

    public Integer getIdPersonaContacto() {
        return idPersonaContacto;
    }

    public void setIdPersonaContacto(Integer idPersonaContacto) {
        this.idPersonaContacto = idPersonaContacto;
    }

    public String getContacto() {
        return contacto;
    }

    public void setContacto(String contacto) {
        this.contacto = contacto;
    }

    public String getTipo() {
        return tipo;
    }

    public void setTipo(String tipo) {
        this.tipo = tipo;
    }

    public Persona getIdPersona() {
        return idPersona;
    }

    public void setIdPersona(Persona idPersona) {
        this.idPersona = idPersona;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idPersonaContacto != null ? idPersonaContacto.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PersonaContacto)) {
            return false;
        }
        PersonaContacto other = (PersonaContacto) object;
        if ((this.idPersonaContacto == null && other.idPersonaContacto != null) || (this.idPersonaContacto != null && !this.idPersonaContacto.equals(other.idPersonaContacto))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "modelo.PersonaContacto[ idPersonaContacto=" + idPersonaContacto + " ]";
    }
    
}
